package com.gouda.core.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by souu on 15/12/5.
 */
public enum PlatformEnum {
    WEIXIN(1, "微信"),
    ANDROID(2, "安卓"),
    IOS(3, "苹果");

    private int code;
    private String msg;

    private PlatformEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private static final Map<Integer, PlatformEnum> interToEnum = new HashMap<Integer, PlatformEnum>();

    static {
        for (PlatformEnum type : PlatformEnum.values()) {
            interToEnum.put(type.getCode(), type);
        }
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static PlatformEnum fromInteger(int code) {
        return interToEnum.get(code);
    }
}
